#include<iostream>
#include<math.h>
using namespace std;
class Point
{
	protected:
		double x;
		double y;
	public:
		void set()
		{
			cout<<"setPoint x y"<<endl;
			cin>>x>>y;
		}
		void display()
		{
			cout<<"Point:\nx:"<<x<<"\ny:"<<y<<endl;
		}
		void distance(Point a)
		{
			double result;
			result=pow(pow(a.x-x,2)+pow(a.y-y,2),0.5);
			cout<<"distance="<<result<<endl;
		}
};
class Point3D:public Point
{
	private:
		double z;
	public:
		void set()
		{
			Point::set();
			cout<<"setPoint3d:z:"<<endl;
			cin>>z;
		}
		void display()
		{
			Point::set();
			cout<<"z:"<<z<<endl;
		}
		void distance(Point3D a)
		{
			double result;
			result=pow(pow(a.x-x,2)+pow(a.y-y,2)+pow(a.z-z,2),0.5);
			cout<<"distance="<<result<<endl;
		}
};
int main()
{
	Point a,b;
	cout<<"seta"<<endl;
	a.set();
	cout<<"setb"<<endl;
	b.set();
	a.distance(b);
	Point3D c,d;
	cout<<"set3dc"<<endl;
	c.set();
	cout<<"set3dd"<<endl;
	d.set();
	c.distance(d);
	return 0;
}
